/*
 LICENSE ANOUNCE HERE
*/

#ifndef __BLOOM_FILTER_H
#define __BLOOM_FILTER_H

#include <stdint.h>
#include <ck_pr.h>

struct bloom_filter {
	unsigned long *bitmap;
	unsigned long  nelem;  /* estimated number of elements */
	unsigned long  nbits;
	int	       nfunc;  /* number of hash functions */
	uint64_t      *seeds;  /* seeds for hash functions */
};

#ifdef __cplusplus
extern "C" {
#endif

int  bloom_create(struct bloom_filter *bf, unsigned long nbits, unsigned long nelem);
void bloom_set(struct bloom_filter *bf, const void *buf, unsigned long buflen);
int  bloom_get(struct bloom_filter *bf, const void *buf, unsigned long buflen);
void bloom_set_hash(struct bloom_filter *bf, unsigned long hash);
int  bloom_get_hash(struct bloom_filter *bf, unsigned long hash);
void bloom_destroy(struct bloom_filter *bf);
void bloom_zero(struct bloom_filter *bf);

#ifdef __cplusplus
}
#endif

#endif
